﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Charades.Web
{
	public class RouteConfig
	{
		public static void RegisterRoutes(RouteCollection routes)
		{
			routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

			routes.MapRoute(
				name: "About",
				url: "about",
				defaults: new { controller = "Home", action = "About" }
			);

			routes.MapRoute(
				name: "UploadImage",
				url: "upload",
				defaults: new { controller = "Home", action = "UploadImage" }
			);

			routes.MapRoute(
				name: "Feed",
				url: "feed",
				defaults: new { controller = "Home", action = "Feed" }
			);

			routes.MapRoute(
				name: "Picture",
				url: "{id}",
				defaults: new { controller = "Home", action = "Picture", id = UrlParameter.Optional },
				constraints: new { id = @"^[a-zA-Z0-9]{8}$" }
			);

			routes.MapRoute(
				name: "Default",
				url: "{controller}/{action}/{id}",
				defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
			);
		}
	}
}
